
@extends('common.header')

<meta name="csrf-token" content="{{ csrf_token() }}">

<br/>
<br/>
<br/>
<br/>
<br/>
<br/>


<div class="col-xs-6 col-md-1">
</div>

<!-- 页面标记 -->
<div class="col-xs-6 col-md-1">
	<mark style="font-size:23px;">{{ $title or '' }}</mark>
</div>

<div class="col-xs-12 col-sm-6 col-md-8">
	<!--  轮播 表格  -->
	<table class="table" style="margin-left:66px;width:88%;">
			<tr style="">
				<td>id</td>
				<td>图片预览</td>
				<td>图片地址</td>
				<td>链接地址</td>
				<td style="width:300px;text-align:center;"><a href="{{ url('/shuffling/create') }}" style="font-size:26px;color:#EE3B3B;" >添加轮播</a></td>
			</tr>
		@foreach( $shufflings_info as $shuffling_info )
			
			<tr style="">
				<td>{{ $shuffling_info->id }}</td>
				<td style="padding: 21px 19px;">
					<img style="width:200px;" src="{{ $shuffling_info->pic_url }}" alt="">
				</td>
				<td style="width:300px;" >{{ $shuffling_info->pic_url }}</td>
				<td style="">{{ $shuffling_info->next_url }}</td>
				<td style="width:300px;text-align:center;">
					@if( $shuffling_info->status == 1 )
						<a style="color:#008B00;font-size:16px;" href="{{ asset('/shuffling/create') }}/{{ $shuffling_info->id }}"> 编辑&nbsp; </a>
						<span> | </span>
						<a onclick="overDate( {{ $shuffling_info->id }} );" style="cursor:pointer;" > &nbsp; 过期 </a>
					@else
						<span>已过期</span>
					@endif
					
				</td>
			</tr>
			
		@endforeach
	</table>
</div>


<!-- 分页 -->
<div style='text-align:center;width:85%;'>
	{{ $shufflings_info->links() }}
</div>
<div class="badge" style="width:100%;text-align:center;font-size:18px;margin-bottom:70px;" >
		共{{ $shufflings_info->total() }}条数据
</div>

<script src=" {{ asset('/js/jquery-1.8.3.min.js') }} "></script>
<script type="text/javascript">
	<!-- 2.设置全局ajax选项 -->
	$.ajaxSetup({
		headers: {
			'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
		}
	});
	var _token = $('meta[name="csrf-token"]').attr('content');
	
	// 轮播 过期
	function overDate( id )
	{
		if( confirm("确认要过期吗？") )
		{
			$.ajax({
				type:"post",
				url:"{{ url('/shuffling/overDate') }}"+'/'+id,
				data:{_token:_token},
				async:true,    					
				dataType:"text",
				success:function(back){
					if(back=='1')
					{
						// 过期成功
						location.reload();
					}else
					{
						alert( '操作失败' );
					}
				}
			});
		}
	}

</script>


@extends('common.footer')